package com.example.demo.io;

import java.io.BufferedInputStream;
import java.io.FileInputStream;

/**
 * @ClassName TestBufferStream
 * @Description TODO
 * @Author hly
 * @Date 2018\11\27 0027 14:03
 */
public class TestBufferStream {
    public static void main(String[] args) {
        FileInputStream fis = null;

        try {
            fis = new FileInputStream("F:\\\\mayun\\\\springboot-parent-demo\\\\sb-some\\\\src\\\\main\\\\java\\\\com\\\\example\\\\demo\\\\SbSomeApplication.java");
            BufferedInputStream bis = new BufferedInputStream(fis);
            int c = 0;
            System.out.println((char) bis.read());
            System.out.println((char) bis.read());
            System.out.println((char) bis.read());
            bis.mark(1);
            for(int i=0;i<=10 && (c = bis.read()) != -1; i++){
                System.out.print((char) c);
            }
            System.out.println();
            bis.reset();
            for (int i = 0; i <= 10 && (c = bis.read()) != -1; i++) {
                System.out.print((char) c);
            }
            bis.close();
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
